Learn Physics by Programming in Haskell
نویسنده
چکیده
We describe a method for deepening a student’s understanding of basic physics by asking the student to express physical ideas in a functional programming language. The method is implemented in a second-year course in computational physics at Lebanon Valley College. We argue that the structure of Newtonian mechanics is clarified by its expression in a language (Haskell) that supports higherorder functions, types, and type classes. In electromagnetic theory, the type signatures of functions that calculate electric and magnetic fields clearly express the functional dependency on the charge and current distributions that produce the fields. Many of the ideas in basic physics are well-captured by a type or a function.
منابع مشابه
NORMC: a Norm Compliance Temporal Logic Model Checker
We describe NORMC, a model checker for Norm Compliance CTL, a temporal logic for reasoning about compliance in normative systems, implemented in the Haskell programming language. NORMC is intended as a tool for students, researchers, and practitioners to learn about and understand normative systems, and as an exploratory tool for researchers in multi-agent systems. The objectives of the paper a...
متن کاملFunctional and Procedural Languages and Data Structures Learning
In this paper authors present a didactic method for teaching Data Structures on Computer Science undergraduate course. An approach using functional along with procedural languages (Haskell and ANSI C) is presented, and adequacy of such a method is discussed. Authors are also concerned on how functional language can help students to learn fundamental concepts and acquire competence on data typin...
متن کاملHandling Exceptions in Haskell
Using a language without exception handling is like driving a car with no brakes and no seatbelt | things work ne until something goes wrong. You also learn to drive rather carefully. This paper describes an exception handling extension to the Haskell lazy functional language. The implementation turned out to be very easy but we had problems nding a viable semantics for our system. The resultin...
متن کاملGeneric Programming with Dependent Types
Some programs are doubly generic. For example, map is datatype-generic in that many different data structures support a mapping operation. A generic programming language like Generic Haskell can use a single definition to generate map for each type. However, map is also arity-generic because it belongs to a family of related operations that differ in the number of arguments. For lists, this fam...
متن کاملA compiler for Cada
Monads have evolved into a powerful and versatile tool for functional programming, but remain a challenging concept for those versed in other paradigms. However, their usefulness encourages us to explore means by which they can be made more accessible. While efforts have been made to introduce syntactic constructs for this purpose, such as the do-notation and monad comprehensions in Haskell, li...
متن کامل